﻿namespace LiveLabs.Logging.Logs
{
    using System;
    using System.IO;
    using Xunit;

    public class StdErrLogFixture
    {
        [Fact]
        public void Should_Write_To_Console_Error_Instance()
        {
            StringWriter newError = new StringWriter();
            TextWriter curError = Console.Error;
            try
            {
                Console.SetError(newError);

                Log log = new StdErrLog();
                log.WriteLine("hello world", LogLevel.Verbose);
            }
            finally
            {
                Console.SetError(curError);
            }

            Assert.Equal("hello world\r\n", newError.ToString());
        }
    }
}
